
$(function() {
	$('body').append(
	'<div class="fixed-tool" id="fixedTool">'+
	'	<div class="fixed-tool-title"><h2>采购进货引导</h2></div>'+
	'	<div class="fixed-tool-content">'+
	'		<a class="bar-tab bar-tab-txt js-link-help-txt" href="javascript:;" target="_blank"><i></i>文档教程</a>'+
	'		<a class="bar-tab bar-tab-video js-link-help-video" href="javascript:;" target="_blank"><i></i>视频教程</a>'+
	'	</div>'+
	'</div>');

	//修改地址
	var host = 'http://' + window.location.host;

	// 如果不是家电化 jdhui.com 域名将不往下执行
	if(!/jdhui\.com/i.test(host)) return;

	$('.js-link-help-txt').attr('href', host+'/views/help-txt.html');//帮助-文本
	$('.js-link-help-video').attr('href', host+'/views/help-video.html');//帮助-视频

	var moveState = false; //是否在移动状态
	var deplay; //延时
	$('.fixed-tool').on('mouseenter', function() {
		var self = this;
		clearTimeout(deplay);
		if(!moveState) {
			moveState = true;
			$(self).find('.bar-tab-txt').animate({
				left: '-99px',
				opacity: '1'
			});
			setTimeout(function() {
				$(self).find('.bar-tab-video').animate({
					left: '-99px',
					opacity: '1'
				}, function() {
					moveState = false;
				});
			}, 50);
		}
	}).on('mouseleave', function() {
		var self = this;
		deplay = setTimeout(function() {
			if(!moveState) {
				moveState = true;
				$(self).find('.bar-tab-txt').animate({
					left: '34px',
					opacity: '0'
				})
				setTimeout(function() {
					$(self).find('.bar-tab-video').animate({
						left: '34px',
						opacity: '0'
					}, function() {
						moveState = false;
					});
				}, 50);
			}
		}, 200);
	});


});
